<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <base href="<%=basePath%>">
    
    <title>添加系统角色</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<script src="js/jquery-1.9.1.min.js" type="text/javascript"></script>
  <link href="css/style.css" rel="stylesheet" type="text/css" />
  <link rel="stylesheet" href="<%=path %>/css/form.css" type="text/css"></link>

  </head>
     <script type="text/javascript">
  	function checkBoxRight(obj){
  		 //当前复选框被选中
  		 if(obj.checked){
  		 	$(obj).parent().parent().find("input").each(function(){
  		 		 this.checked=true;
  		 	});
  		 }else{//当前复选框取消选中
  			$(obj).parent().parent().find("input").each(function(){
  		 		 this.checked=false;
  		 	});
  		 }
	}
	//全选
	function checkAlls(){
	 	$("#rightTable input[type='checkbox']").each(function(){
	 		 this.checked=true;
	 	});
	}
	//取消全选
	function cancelCheckAll(){
		$("#rightTable input[type='checkbox']").each(function(){
	 		 this.checked=false;
	 	});
	}
	
  </script>
    
  <body>
  
    	<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    <li><a href="#">首页</a></li>
   
   <li><a href="#">添加系统角色</a></li>
    </ul>
    </div>
    
    <div class="formbody">
    
    <div class="formtitle"><span>基本信息</span></div>
    <form action="<%=basePath%>admin/addSysrole.action" method="post" id="myform">
    <ul class="forminfo">
    <li><label>角色编号</label><input name="sysrole.roleid" type="text" class="dfinput" /></li>
    <li><label>角色名称</label><input name="sysrole.rolename" type="text" class="dfinput" /></li>
    <li><label>权限选择</label></li>
    
    <li>
    	
						<font color="#FF0000">*必填</font>至少选择一个权限<br>
						<input type="button" id = "checkAll" onclick="checkAlls()" value="全选"> &nbsp;&nbsp;&nbsp;&nbsp;
						<input type="button" id = "cancelcheckAll" value="取消全选" onclick="cancelCheckAll()"> <br>
						<span id="msgrightId" class="msgRed"></span>
						<table align="center" id="rightTable" width="100%"  border="0" cellpadding="3" cellspacing="1" width="100%" align="center" style="background-color: #b9d8f3;">
							<s:iterator value="listSysright"  var="right1">
						
							<s:if test='#right1.prightid == "0" '>
							<tr style="text-align: center; COLOR: #0076C8; BACKGROUND-COLOR: #F4FAFF; font-weight: bold">
							<td style="vertical-align: top;">
								<input name="rightId" id="rightId_${right1.rightid}" type="checkbox" class="dfinput1" value="${right1.rightid}" onclick="checkBoxRight(this)"/>${right1.rightname}
							</td>
							<td>
							<table>
							<s:iterator value="listSysright" var="right2">
							<s:if test="#right2.prightid == #right1.rightid">
								<tr><td  style="vertical-align: top;width: 50%">
								<input name="rightId" id="rightId_${rightid}" type="checkbox" class="dfinput1" value="${rightid}"/>${rightname}
									</td>
									<td>
									<s:iterator value="listSysright" var="right3">
									<s:if test="#right3.prightid == #right2.rightid">
										<input name="rightId" id="rightId_${rightid}" type="checkbox" class="dfinput1" value="${rightid}"/>${rightname}</br>
									</s:if>
									</s:iterator>
									</td>
									</tr>
							</s:if>
							</s:iterator>
							</table>
							</td>
							</tr>
							</s:if>
				    		</s:iterator>
			    		</table>
					</li>
    
    <li><label>&nbsp;</label><input name="" type="submit" class="btn" value="确认保存"/> <input type="button" name="button" value="返回" class="btn" onclick="javascript:window.history.back(-1);"/></li>
    </ul>
    
    </form>
    </div>

    
  </body>
</html>
